using Game.Main.Model;

namespace Game.Component
{
	public class FlowerpotItem : BaseItem
	{
		private GrowPlantItem plant;

		public override void Init(ItemArchiveData data)
		{
			base.Init(data);
		}

		public bool CanGrowUp()
		{
			if (plant == null || !plant.CanGrowUp())
			{
				return false;
			}
			return true;
		}

		public void GrowUp()
		{
			if (plant != null)
			{
				plant.GrowUp();
			}
		}

		public override bool AttachItem(BaseItem item, DepthType depthType, AttachType attachType, bool updatePosition)
		{
			bool flag = base.AttachItem(item, depthType, attachType, updatePosition);
			if (flag && item.itemData.scriptType == 147)
			{
				plant = (GrowPlantItem)item;
			}
			return flag;
		}

		public override void ReleaseAttachItem(BaseItem item)
		{
			base.ReleaseAttachItem(item);
			if (plant == item)
			{
				plant = null;
			}
		}

		public override bool CanAttatchItem()
		{
			if (childItems.Count > 0)
			{
				return false;
			}
			return base.CanAttatchItem();
		}
	}
}
